package edu.sctu.practice.class02.hujie.cgs.assign02;

/**
 * Created by hj on 2015/10/22.
 */
public class Rational {
    double num1;
    double num2;
    double num3;

    public Rational(double num1, double num2) {
        this.num1 = num1;
        this.num2 = num2;
    }

    public double getSum() {
        return num3 = num1 + num2;
    }

    public double getMinus() {
        return num3 = num1 - num2;
    }

    public double getMultiply() {
        return num3 = num1 * num2;
    }

    public double getDivide() {
        return num3 = num1 / num2;
    }

    public static void main(String[] args) {
        Rational rational = new Rational(3.2, 1.3);
        System.out.println("加法为" + rational.getSum());
        System.out.println("减法为" + rational.getMinus());
        System.out.println("乘法为" + rational.getMultiply());
        System.out.println("除法为" + rational.getDivide());
    }
}
